#include <string.h>

void *memchr( const void *s, int c, size_t n ) {
  unsigned char *p = ( unsigned char * )s;
  unsigned char *end = p + n;
  for( ; p != end; p++ )
    if( *p == c )
    { return( ( void * )p ); }
  return( 0 );
}
